public class Factory implements IPartType{

	Stock stock;
	Purchasing purchasing;
	
	
	
	
	public Factory(Purchasing p, ReceivingStock s){
		this.stock=s;
		this.purchasing=p;
	}
	
	public Part create(int PartType, String id, String name){
		
		switch (PartType){
		
		case 1 : return new Components(id, name);
		case 2 : return new SingleComponent(id, name);
		case 3 : return new Resource(id, name);
		default: return null;
		}
	}
	
	
	
	public static void main(String[] args) {
		
		final Purchasing purch;
		final ReceivingStock rs;
		final Factory f;
		Part p;
		
		
	rs = new ReceivingStock(2,10);
	purch = new Purchasing(rs);
	f = new Factory(purch,rs);
	p = f.create(IPartType.SINGLE_COMPONENT, "0", "A Single Component");
	
	rs.insert(p, 10);
	System.out.println(rs.get(p));
	}
	
}
